<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title><?php echo ($title); ?></title>
    <link rel="stylesheet" href="/Public/web/css/pintuer.css">
    <link rel="stylesheet" href="/Public/web/css/admin.css">
    <script src="/Public/web/js/jquery.js"></script>
    <script src="/Public/web/js/pintuer.js"></script>
</head>


<body>
  <form action="" id="listform">
    <div class="panel admin-panel">
      <div class="panel-head"><strong class="icon-reorder"> 体验者</strong></div>
      <div class="padding border-bottom">
        <ul class="search" style="padding-left:10px;">
          <li>绑定体验者：</li>
          <li><input class="input" type="text" name="wechatid" value="<?php echo ($wechatid); ?>" placeholder="请输入体验者微信号"></li>
          <li><input type="button" value="绑定" class="button border-main icon-search" onclick="return bdsub()"/></li>
        </ul>
      </div>
      <table class="table table-hover text-center">
        <tr>
          <th>微信号</th>
          <th>绑定时间</th>
          <th width="310">操作</th>
        </tr>
        <?php if(is_array($info)): foreach($info as $key=>$v): ?><tr class="tr<?php echo ($v['accradmin_id']); ?>">
            <td><?php echo ((isset($v['wechatid']) && ($v['wechatid'] !== ""))?($v['wechatid']):"--"); ?></td>
            <td><?php echo (date("Y-m-d H:i:d",$v['addtime'])); ?></td>
            <td>
              <div class="button-group">
                <a class="button border-red" href="javascript:void(0)" onclick="return del(<?php echo ($v['accradmin_id']); ?>)"><span class="icon-trash-o"></span> 解除绑定</a>
              </div>
            </td>
          </tr><?php endforeach; endif; ?>
      </table>
    </div>
  </form>
  <script type="text/javascript">
    function bdsub(){
    	var wechatid = $("input[name='wechatid']").val();
     	if(wechatid){
    		var url = "<?php echo U('Accredit/adminer');?>";
    		$.getJSON(url,{wechatid:wechatid},function (data){
        		if(data.result == 'ok'){alert('申请成功，请在该微信接受绑定邀请');location.reload();}
         		else{alert(data.result);}
        	})
      	}else{
      		alert('请输入需要绑定的微信号');
      	}
    }


    function del(id){
    	if(confirm("确认解除绑定吗？")){
        	var url = "<?php echo U('Accredit/adminer_del');?>";
        	$.getJSON(url,{id:id},function (data){
        		if(data.result == 'ok'){$(".tr"+id).remove();}
         		else{alert(data.result);}
        	})
      	}
    }
  </script>
</body>

</html>